package org.apache.rocketmq.client.java.impl.producer;

import apache.rocketmq.v2.*;
import com.google.common.util.concurrent.ListenableFuture;
import io.grpc.stub.StreamObserver;
import org.apache.rocketmq.client.java.clientapis.ClientException;
import org.apache.rocketmq.client.java.route.Endpoints;

import java.util.concurrent.ScheduledExecutorService;

/**
 * @课程描述:从零带你写框架系列中的课程，整个系列包含netty，xxl-job，rocketmq，nacos，sofajraft，spring，springboot，disruptor，编译器，虚拟机等等。
 * @author：陈清风扬，个人微信号：chenqingfengyangjj。
 * @date:2025/6/10
 * @方法描述：客户端与服务端的会话处理器，用于处理客户端与服务端的会话。
 */
public interface ClientSessionHandler {

    @SuppressWarnings("BooleanMethodIsAlwaysInverted")
    boolean isRunning();

    ScheduledExecutorService getScheduler();

    boolean isEndpointsDeprecated(Endpoints endpoints);

    ListenableFuture<Void> awaitSettingSynchronized();

    String clientId();

    TelemetryCommand settingsCommand();

    StreamObserver<TelemetryCommand> telemetry(Endpoints endpoints, StreamObserver<TelemetryCommand> observer)
            throws ClientException;

    void onSettingsCommand(Endpoints endpoints, Settings settings);

    void onRecoverOrphanedTransactionCommand(Endpoints endpoints, RecoverOrphanedTransactionCommand command);

    void onVerifyMessageCommand(Endpoints endpoints, VerifyMessageCommand command);

    void onPrintThreadStackTraceCommand(Endpoints endpoints, PrintThreadStackTraceCommand command);
}
